<?php
/**
 * Created by PhpStorm.
 * User: evan.wan
 * Date: 2015/8/7
 * Time: 16:14
 */
namespace Admin\Controller;

use Think\Controller;

class LoginController extends Controller{
    public function index(){
        if(IS_POST){
            $login = array();
            switch(I('user', null, false)) {
                case 'admin' :
                    $login['uid'] =1;
                    $login['user'] = 'admin';
                    break;
                case 'test' :
                    $login['uid'] =2;
                    $login['user'] = 'test';
                    break;
                case 'guest' :
                    $login['uid'] =3;
                    $login['user'] = 'guest';
                    break;
                default :
                    $this->error('�����ڴ��û�!');
                    break;
            }
            if(count($login)){
                session('auth', $login);
                $this->success('登陆成功！', U('Index/index'));
            }


        }

        $this->display();

    }
}